-
Notifications
You must be signed in to change notification settings - Fork 8k
scripts: compliance: Add basic cmake style checks #96846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts: compliance: Add basic cmake style checks #96846
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me, thanks!
It is very common to see a comment stating that the "No Space Before Opening Brackets" style guide is not followed. To avoid putting this burdon on reviewers, let the compliance check catch this instead. Checking for tab indentation was also very simple, so also added this. Running this check on all files finds many violations: - Space before opening brackets: 141 violations - Tab indentation: 420 violations Fixing these will not be done as part of this PR. Adding the check will prevent us from adding new violations. Signed-off-by: Rubin Gerritsen <[email protected]>
29de76a
to
2e70ea3
Compare
|
mime=True) == "text/x-python")] | ||
|
||
|
||
class CMakeStyle(ComplianceTest): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is better to split this into own script to be able to extend it in the future with more cmake style checks and also be able to run it standalone and just call that script from check_compliance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is very rudimental, it doesn't check for elseif
/else
/endif
/foreach
/endforeach
and probably many more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thart is my point. my concern is that we will start expanding the linter functionality inside check_compliance, which is in general a wrapper on top of linters, not a linter itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let me know if you want me to update the commit. I would be happy if you could point me to existing examples of such linters and where to put the python script linting cmake code.
It is very common to see a comment stating that the "No Space Before Opening Brackets" style guide is not followed. To avoid putting this burdon on reviewers, let the compliance check catch this instead.
Checking for tab indentation was also very simple, so also added this.
Running this check on all files finds many violations:
Fixing these will not be done as part of this PR. Adding the check will prevent us from adding new violations.
Attached file with list of current style violations:
CMakeStyle.txt